package cz.muni.fi.pa165.bookingmanager.dto;

import cz.muni.fi.pa165.bookingmanager.entities.AdminRole;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 *
 * @author Štefan Repček
 */
public class AdministratorDTO {

    private Long id;
    private String firstName;
    private String surName;
    private String username;
    private String password;
    private List<AdminRoleDTO> roles;

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getSurName() {
        return surName;
    }

    public void setSurName(String surName) {
        this.surName = surName;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
    
    public List<AdminRoleDTO> getRoles() {
        if (this.roles == null) {
            return null;
        }

        return Collections.unmodifiableList(this.roles);
    }

    public void setRoles(List<AdminRoleDTO> roles) {
        this.roles = null;

        if (roles != null) {
            this.roles = new ArrayList<AdminRoleDTO>();
            this.roles.addAll(roles);
        }
    }
        
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof AdministratorDTO)) {
            return false;
        }
        AdministratorDTO other = (AdministratorDTO) object;
        if ((this.id == null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return firstName + " " + surName;
    }
}
